import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import vueDevTools from 'vite-plugin-vue-devtools'
import path from 'node:path'

// https://vite.dev/config/
export default defineConfig({
  server: {
    port: 8080,
    host: "localhost",
    proxy: {
      '/api': {
        target: 'https://localhost:5131',
        changeOrigin: true,
        // rewrite: (path) => path.replace(/^\/api/, '')
      },
      '/mock-api': {
        target: 'https://localhost:7198',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/mock-api/, '')
      }
    }
  },
  plugins: [
    vue(),
    vueJsx(),
    vueDevTools(),
  ],
  // resolve: {
  //   alias: {
  //     '@': fileURLToPath(new URL('./src', import.meta.url))
  //   },
  // },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src")
    },
  }

})
